/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.group4.highschoolportal.util;

import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ApplicationScoped;
import java.util.Calendar;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 *
 * @author José
 */
@ManagedBean(name="DateTimeUtilityBean")
@ApplicationScoped
public class DateTimeUtilityBean implements Serializable {

    private Date date;
    private String data = "";
        
        /** Creates a new instance of DateTimeUtilityBean */
    public DateTimeUtilityBean() {

    }
    //@PostConstruct
    public String getCurrentDateTime() {
        Calendar rightNow = Calendar.getInstance();
        this.date = rightNow.getTime();
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        return dateFormat.format(date);
    }

    public String getData() {
        data = getCurrentDateTime();
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }
    
}
